
const state = () => ({
  user:{},
  isLogin:false,

})
const getter = {

  }
;
 const mutations = {
  getUser (state, user) {
    state.user=user
    state.isLogin=true
  },
  logout(state) {
    state.user={}
    state.isLogin=false
  }
 }
const actions = {
  async getUser({commit}) {
    const  user=await this.$axios.$get('/api/user');
    if (user.code!=500){
      commit('getUser', user);
    }

  }
};
export default {
  namespaced: true,
  state,
  getter,
  actions,
  mutations
};
